// 管理购物车的reducer
// 默认状态
let defaultState = {
  cartList: [],
};

// 购物车reducer  是一个函数
let cartReducer = (state = defaultState, action) => {
  switch (action.type) {
    case "GET_CART_LIST":
      let cartState = {...state};
      cartState.cartList = action.cartlist
      return cartState
      default:
        return state;
    
  }
  return state;
};

export default cartReducer;
